package com.zby.zbyliving.commodity.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zby.common.utils.PageUtils;
import com.zby.zbyliving.commodity.entity.AttrAttrgroupRelationEntity;
import com.zby.zbyliving.commodity.entity.AttrEntity;

import java.util.List;
import java.util.Map;

/**
 * 商品属性表
 *
 * @author zby
 * @email 2069189112@qq.com
 * @date 2023-07-31 00:17:47
 */
public interface AttrService extends IService<AttrEntity> {

    PageUtils queryPage(Map<String, Object> params);

    void saveAttrAndRelation(AttrEntity attr);

    PageUtils queryBaseAttrPage(Map<String, Object> params, Long categoryId);
    PageUtils querySaleAttrPage(Map<String, Object> params, Long categoryId);

    List<AttrEntity> getRelationAttr(Long attrgroupId);

    /**
     * 批量删除属性组和属性的关联关系
     */
    void deleteRelation(AttrAttrgroupRelationEntity[] attrAttrgroupRelationEntities);

    /**
     * 获取某个属性组可以关联的基本属性
     * 1. 如果某个基本属性已经和某个属性组关联了, 就不能再关联
     * 2. 某个属性组可以关联的基本属性，必须是同一个分类
     */

    PageUtils getAllowRelationAttr(Map<String, Object> params, Long attrgroupId);
}

